menubutton: Add `active` property and getter/setter
authorChristopher Davis <christopherdavis@gnome.org>
Sun, 12 Feb 2023 21:14:43 +0000 (16:14 -0500)
committerChristopher Davis <christopherdavis@gnome.org>
Sun, 12 Feb 2023 21:47:59 +0000 (16:47 -0500)
commitff45145eac76255a0d3d95063c7f053302611471
tree3699817c7fbf6a54fd03bdfd8c53143226f7353e
parent84b5e94ffdfbb8449dc4955b8e865ad44627a40c
menubutton: Add `active` property and getter/setter

GtkMenuButton currently does not provide a way to tell
if it's open programmatically. The existing methods,
`popup()` and `popdown()`, do not expose any state
to callers. If someone wanted to know whether or not
a menubutton was open, they needed the popover. Given
that GtkMenuButton can manage the popovers itself,
that's not always an option for app developers.

This commit adds the `active` property and associated
methods, where `gtk_menu_button_set_active ()` replaces
both `gtk_menu_popup ()` and `gtk_menu_popdown ()`.
This addition also mirrors changes in other places,
Such as `GtkWidget:visible` vs `show()`/`hide()`.
gtk/gtkmenubutton.c
gtk/gtkmenubutton.h